package cn.edu.zut.internship.service.impl.sys;

import cn.edu.zut.internship.bean.sys.Result;
import cn.edu.zut.internship.iservice.sys.SemesterSV;
import cn.edu.zut.internship.mapper.sys.SemesterMapper;
import cn.edu.zut.internship.utils.PrimaryKeyUtil;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;
@Service
public class SemesterSVImpl implements SemesterSV {
    @Autowired
    SemesterMapper semesterMapper;
    @Autowired
    PrimaryKeyUtil primaryKeyUtil;
    @Override
    public Result getSemesterList() {
        Result result = new Result();
        List<Map> semesterList = semesterMapper.getSemesterList();
        result.setBeans(semesterList);
        return result;
    }

    @Override
    public Result newSemester(Map params) {
        Result result = new Result();
        Long semesterId = primaryKeyUtil.generatePrimaryKey("semester");
        params.put("semesterId",semesterId);
        semesterMapper.newSemester(params);
        return result;
    }
}
